/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ifrr.gepro.projeto.bean;

import br.ifrr.gepro.pessoa.bean.TecnicoBean;
import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author rafael
 */
@Entity
@Table(name = "equipe", catalog = "gepro", schema = "public")

public class EquipeBean implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id_equipe", nullable = false, insertable=false)
    private Integer idEquipe;
    @Column(name = "nome", length = 45)
    private String nome;
    @JoinTable(name = "tec_equipe", joinColumns = {
        @JoinColumn(name = "fk_eqp", referencedColumnName = "id_equipe", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "fk_tec", referencedColumnName = "id_tecnico", nullable = false)})
        @ManyToMany
    private Collection<TecnicoBean> tecnicoBeanCollection;
//    @JoinColumn(name = "fk_projeto", referencedColumnName = "id_projeto")
//    @ManyToOne
//    private ProjetoBean fkProjeto;

    public EquipeBean() {
    }

    public EquipeBean(Integer idEquipe) {
        this.idEquipe = idEquipe;
    }

    public Integer getIdEquipe() {
        return idEquipe;
    }

    public void setIdEquipe(Integer idEquipe) {
        this.idEquipe = idEquipe;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Collection<TecnicoBean> getTecnicoBeanCollection() {
        return tecnicoBeanCollection;
    }

    public void setTecnicoBeanCollection(Collection<TecnicoBean> tecnicoBeanCollection) {
        this.tecnicoBeanCollection = tecnicoBeanCollection;
    }

//    public ProjetoBean getFkProjeto() {
//        return fkProjeto;
//    }
//
//    public void setFkProjeto(ProjetoBean fkProjeto) {
//        this.fkProjeto = fkProjeto;
//    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEquipe != null ? idEquipe.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof EquipeBean)) {
            return false;
        }
        EquipeBean other = (EquipeBean) object;
        if ((this.idEquipe == null && other.idEquipe != null) || (this.idEquipe != null && !this.idEquipe.equals(other.idEquipe))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.ifrr.gepro.EquipeBean[ idEquipe=" + idEquipe + " ]";
    }
    
}
